import api from './index'
import request from '@/utils/request'


/*
* 不需要loading的接口 设置
* loading:false
* */

// 用户名称 get 方法
// export function getUserName(params) {
//   return request({
//     url: api.UserName,
//     method: 'get',
//     params,
//     hideloading: true
//   })
// }

// /siminfo/getCardList/{clientId}
// 查询用户绑定的卡列表
export function getCardList(clientId) {
  return request({
    url: '/client/wx/sim/list',
    method: 'get',
  })
}
// /client/wx/sim
// 微信端用户绑定SIM卡
export function bindCard(data) {
  return request({
    url: '/client/wx/sim',
    method: 'post',
    data
  })
}
// 解除指定卡的实名认证 /client/wx/sim/realname
export function unbindCard(data) {
  return request({
    url: '/client/wx/sim/realname',
    method: 'delete',
    data
  })
}
// GET /client/wx/sim/masterorder 根据SIM卡查询当前生效的主包订购
export function getMasterOrder(params) {
  return request({
    url: '/client/wx/sim/masterorder',
    method: 'get',
    params,
  })
}


// 查询sim卡可订购套餐列表  /pkg/flow/sim
export function getPkgByCard(params) {
  return request({
    url: '/client/wx/sim/orderable',
    method: 'get',
    params,
  })
}

// 用户查询名下未完成实名的SIM卡列表 /client/wx/sim/list/unreal
export function getUnrealNameCard() {
  return request({
    url: '/client/wx/sim/list/unreal',
    method: 'get',
  })
}
// 提交订单 trade/wx/save
export function trade(data) {
  return request({
    url: '/trade/wx/save',
    method: 'post',
    data
  })
}

// 查询订单详情 trade/wx/{tradeId}
export function getTradeDetail(tradeId) {
  return request({
    url: 'trade/wx/'+tradeId,
    method: 'get',
  })
}
// 立即支付 /trade/wx/pay/{tradeId}
export function pay(data) {
  return request({
    url: '/trade/wx/pay/js',
    method: 'post',
    data
  })
}

// 流量查询 simflow
export function getSimFlow(data) {
  return request({
    url: '/simflow/wx/query',
    method: 'post',
    data
  })
}
// 修改指定卡号的实名认证状态为实名中 /client/wx/sim/realname/status
export function modifyRealNameStatus(data) {
  return request({
    url: '/client/wx/sim/realname/status',
    method: 'put',
    data
  })
}
// 微信支付后回调 /trade/wx/notify/{tradeId}
export function notifyTrade(tradeId) {
  return request({
    url: '/trade/wx/notify/'+tradeId,
    method: 'get',
  })
}
// 余额查询 /recharge/wx/balance/{msisdn}
export function getRecharge(msisdn) {
  return request({
    url: '/recharge/wx/balance/'+msisdn,
    method: 'get',
  })
}

// 充值-发起充值 /recharge/wx/create
export function postRecharge(data) {
  return request({
    url: '/recharge/wx/create',
    method: 'post',
    data
  })
}
//充值-立即支付（微信) /recharge/wx/pay
export function payRecharge(data) {
  return request({
    url: '/recharge/wx/pay',
    method: 'post',
    data
  })
}
//充值-支付回调（微信） /recharge/wx/recharge/{tradeNo}
export function rechargeCallback(tradeNo) {
  return request({
    url: '/recharge/wx/recharge/'+tradeNo,
    method: 'get',
  })
}

// 使用余额支付 /trade/wx/payByBalance/{tradeId}
export function recharge(tradeId) {
  return request({
    url: '/trade/wx/payByBalance/'+tradeId,
    method: 'get',
  })
}
